Attribute VB_Name = "Module1"

Private Declare Function ECF_AbreCupomMFD Lib "CONVECF.DLL" (ByVal cCPF As String, ByVal cNome As String, ByVal cEnd As String) As Integer
Private Declare Function ECF_VendeItem Lib "CONVECF.DLL" (ByVal CodProd As String, ByVal Descr As String, ByVal Aliq As String, ByVal TipQtde As String, ByVal Qtde As String, ByVal CasasDec As Integer, ByVal Preço As String, ByVal TipoDesc As String, ByVal Desc As String) As Integer
Private Declare Function ECF_AcrescimoDescontoItemMFD Lib "CONVECF.DLL" (ByVal item As String, ByVal AcrescDesc As String, ByVal TipoAcrDesc As String, ByVal Valor As String) As Integer
Private Declare Function ECF_CancelaItemGenerico Lib "CONVECF.DLL" (ByVal NumItem As String) As Integer
Private Declare Function ECF_SubTotalizaCupomMFD Lib "CONVECF.DLL" () As Integer
Private Declare Function ECF_AcrescimoDescontoSubtotalMFD Lib "CONVECF.DLL" (ByVal AcrescDesc As String, ByVal TipoAcrDesc As String, ByVal Valor As String) As Integer
Private Declare Function ECF_TotalizaCupomMFD Lib "CONVECF.DLL" ()
Private Declare Function ECF_FechaCupom Lib "CONVECF.DLL" (ByVal MeioPag As String, ByVal AcresDesc As String, ByVal TipoAcrDesc As String, ByVal ValAcrDesc As String, ByVal ValorPago As String, ByVal Mens As String) As Integer


Function CupomFiscal()
     
  Dim cCPF, cNome, cEnd As String
  Dim I As Integer
  
' --------Abrir Cupom--------
   cCPF = Space(20)
   cNome = Space(30)
   cEnd = Space(80)
   
   cCPF = "12.456.789-198"
   cNome = "Nome do consumidor"
   cEnd = "Endereço do consumidor"
   
  
   retorno = ECF_AbreCupomMFD(cCPF, cNome, cEnd)
   
   MsgBox " 'Abre Cupom' " & vbCrLf & "Status: " & retorno
    

' --------Inserir 3 itens--------
For I = 1 To 3

   retorno = ECF_VendeItem("123456", "Sapato", "1200", "I", "2", 2, "1,35", "%", "0000")
   
   MsgBox " 'Vende Item " & I & "'" & vbCrLf & "Status: " & retorno
   
' --------Desconto em 3 itens--------
   retorno = ECF_AcrescimoDescontoItemMFD("00" & I, "D", "$", "100")
   
   MsgBox " 'Desconto Item' " & vbCrLf & "Status: " & retorno
Next

' --------Cancelar item--------
   retorno = ECF_CancelaItemGenerico("001")
   
   MsgBox " 'Cancelar Item' " & vbCrLf & "Status: " & retorno
   
' --------SubTotal do Cupom--------
   retorno = ECF_SubTotalizaCupomMFD
   
   MsgBox " 'SubTotalização do Cupom' " & vbCrLf & "Status: " & retorno
   
' --------Acréscimo em item--------
   retorno = ECF_AcrescimoDescontoSubtotalMFD("A", "$", "2,00")
   
   MsgBox " 'Acréscimo Subtotal' " & vbCrLf & "Status: " & retorno

' ---------Fechar Cupom----------
   retorno = ECF_FechaCupom("Cartão", "A", "%", "0000", "5,40", "Volte sempre !")
   
   MsgBox " 'Fechar Cupom' " & vbCrLf & "Status: " & retorno
End Function
